<template>
	<view class="mainbgc" v-if="pageShow">
		<view class="header-top-box">
			<view class="header-top fff flexbetween">
				<view class="top-image" @click="gotoBack()"></view>
				<view class="flexcenter">
					<view :class="currenttab==1?'selecbottab tab1':'noselecbottab tab1'" @click="selecChangetab(1)">销货<text v-show="allNum.total_sale_order_num">({{allNum.total_sale_order_num || ""}})</text>
					</view>
					<view :class="currenttab==2?'selecbottab tab2':'noselecbottab tab2'" @click="selecChangetab(2)">退货<text v-show="allNum.total_saleth_order_num">({{allNum.total_saleth_order_num || ""}})</text>
					</view>
				</view>
				<view class="konghezi" @click="show=true">筛选</view>
			</view>
		</view>
		<!-- 头部切换 -->
		<view class="ffffff tabs">
			<view class="flexbetween">
				<template v-if="currenttab==1">
					<view :class="seal_status==30?'focustext':'nofocustext'" @click="selectab('seal_status',30)">待发货<text v-show="allNum.df_sale_order_num">({{allNum.df_sale_order_num || ""}})</text></view>
					<view class="fenge"></view>
					<view :class="seal_status==40?'focustext':'nofocustext'" @click="selectab('seal_status',40)">待收货<text v-show="allNum.ds_sale_order_num">({{allNum.ds_sale_order_num || ""}})</text></view>
					<view class="fenge"></view>
					<view :class="seal_status==50?'focustext':'nofocustext'" @click="selectab('seal_status',50)">已签收<text v-show="allNum.yqs_sale_order_num">({{allNum.yqs_sale_order_num || ""}})</text></view>
				</template>
				<template v-if="currenttab==2">
					<view :class="return_status==20?'focustext':'nofocustext'" @click="selectab('return_status',20)">待取货<text v-show="allNum.df_saleth_order_num">({{allNum.df_saleth_order_num || ""}})</text>
					</view>
					<view class="fenge"></view>
					<view :class="return_status==30?'focustext':'nofocustext'" @click="selectab('return_status',30)">已取货<text v-show="allNum.ds_saleth_order_num">({{allNum.ds_saleth_order_num || ""}})</text>
					</view>
					<view class="fenge"></view>
					<view :class="return_status==40?'focustext':'nofocustext'" @click="selectab('return_status',40)">已完成<text v-show="allNum.yqs_saleth_order_num">({{allNum.yqs_saleth_order_num || ""}})</text>
					</view>
				</template>
			</view>
			<view class="flexcenter margin_top">
				<view class="nofocustext" v-if="distance_sort==0" @click="distance_sort=1;init()">有近到远</view>
				<view class="focustext" v-if="distance_sort==1" @click="distance_sort=0;init()">有近到远</view>
			</view>
		</view>
		
		<view class="mainpadding2" style="padding-bottom: 200rpx;">
			<view class="flexcenter" v-if="!list.total">
				<view class="placeholderimage"></view>
			</view>
			<view class="mainpadding ffffff margin_top radius" v-for="item in list.data" :key="item.id">
				<!-- 大分类 -->
				<view class="childtop flexleft" style="position: relative;">
					<view class="ylable flexcenter importfive" v-if="item.custom.costom_level_info">{{item.custom.costom_level_info.name}}</view>
					<view class="margin_right">
						<!-- 选中 -->
						<view class="selecticon" v-show="item.is_check && !item.is_disabled" @click.stop="changeCheck(item)">
							<image src="@/static/image/system/dui.png" mode=""></image>
						</view>
						<!-- 未选中 -->
						<view class="noselecticon" v-show="!item.is_check && !item.is_disabled" @click.stop="changeCheck(item)"></view>
						<!-- 禁用 -->
						<view class="disselecticon" v-show="item.is_disabled">
							<image src="@/static/image/system/dui.png" mode=""></image>
						</view>
					</view>
					<view class="right" @click="jumpdetail(item.id)">
						<view class="flexleft flex_wrap">
							<view class="bigtext margin_right1">{{item.custom.name}}</view>
							<view class="xiaohui margin_right1">{{item.custom.username}}</view>
							<view class="littleblue margin_right1" @click.stop="phone(item.custom.mobile)"></view>
							<view class="xiaohong margin_right1" v-show="item.is_bj==2">变价</view>
							<view class="xiaohong" v-show="item.is_ht==2">含退</view>
						</view>
						<view class="flexbetween margin_top1">
							<view class="dizhi flexleft">
								<view class="xiankuan">地址：{{item.custom.cityinfo}}{{item.custom.address}}</view>
								<view class="juli">{{kmUnit(Number(item.distance))}}</view>
								<view class="addressicon" style="margin-right: 20rpx;" @click.stop="openmap(item.custom)">
								</view>
							</view>
						</view>
						<view class="dizhi margin_top1" v-if="currenttab==1">数量：<text class="xiaolan">销{{item.x_goods_zl_num}}种/{{item.x_goods_num}}箱{{Number(item.x_goods_sendnum)?"（含赠品）":""}}</text> <text class="xiaohong margin_left2" v-show="item.t_goods_zl_num">退{{item.t_goods_zl_num}}种{{item.t_goods_num}}箱</text></view>
						<view class="dizhi margin_top1" v-if="currenttab==2">数量：<text class="xiaohong margin_left2" v-show="item.goods_zl_num">退{{item.goods_zl_num}}种{{item.goods_num}}箱{{Number(item.goods_sendnum)?"（含赠品）":""}}</text></view>
						<view class="dizhi margin_top1">订单来源：
						<text class="xiaohuang">{{item.ly_type==1?"订货通":"小程序"}}</text></view>
						<view class="dizhi margin_top1">订单编号：{{item.order_no}}</view>
						<view class="margin_top1 flexbetween">
							<view class="dizhi" v-if="(currenttab==1 && (seal_status==30 || seal_status==40)) || (currenttab==2 && (return_status==30 || return_status==20))">
								<text v-if="Number(item.arrears_price)!=0">
									合计：<text class="xiaohong">{{item.arrears_price}}</text>
								</text>
								<text v-if="Number(item.arrears_price)==0" style="color: #59C38F;">已付款</text>
							</view>
							<view class="dizhi" v-else>
								<text v-show="Number(item.arrears_price)">合计：<text class="xiaohong">{{item.arrears_price}}</text></text>
							</view>
							<view class="dizhi">{{item.createtime_text}}</view>
						</view>
					</view>
				</view>
				<!-- 销售单 -->
				<view class="flexcenter" v-if="currenttab==1">
					<view class="jushou margin_top margin_right" v-show="item.status!=50 && seal_status==40" @click.stop="jushoubtn(item.id,61)">拒收</view>
					<view class="childbottom" v-show="item.status==30" @click.stop="quhuoapi(item.id,60)">
						<text class="childbottomtxt">确认取货</text>
					</view>
					<view class="childbottom" v-show="Number(item.arrears_price)==0 && item.status==40" @click.stop="songdaapi(item.id,62)">
						<text class="childbottomtxt">确认送达</text>
					</view>
					<view class="jushou margin_top" style="width: 500rpx;" v-show="Number(item.arrears_price)!=0 && item.status==40" @click.stop="sdShoukuan(item.id,63)">确认送达收款</view>
				</view>
				<!-- 退货单 -->
				<view class="flexcenter" v-if="currenttab==2">
					<view class="jushou margin_top margin_right" v-show="item.status==20" @click.stop="jushoubtn(item.id,67)">拒收</view>
					<view class="childbottom" v-show="item.status==20" @click.stop="quhuoapi(item.id,66)">
						<text class="childbottomtxt">确认取货</text>
					</view>
				</view>
			</view>
		</view>
		<!-- 销售司机送货底部数据信息 -->
		<view class="pagebottom flexbetween" v-if="list.data.length && currenttab==1">
			<view class="pagebottom_left flexcenter" @click="changeAllCheck">
				<view class="">
					<view class="selecticon" v-show="list.is_all" >
						<image src="@/static/image/system/dui.png" mode=""></image>
					</view>
					<view class="noselecticon" v-show="!list.is_all"></view>
				</view>
				<view><text class="allchange">全选</text></view>
			</view>
			<view class="flexright">
				<text class="pagebottom_fahuo margin_right" v-show="seal_status==30" @click="quhuoFn(60)">一键取货</text>
				<text class="pagebottom_fahuo margin_right" v-show="seal_status==40" @click="songdaFn(62)">一键送达</text>
				<text class="pagebottom_huizong" v-show="seal_status!=40" @click="msghuizong(1,64)">数据汇总</text>
			</view>
		</view>
		<view class="pagebottom flexbetween" v-if="list.data.length && currenttab==2">
			<view class="pagebottom_left flexcenter" @click="changeAllCheck">
				<view class="">
					<view class="selecticon" v-show="list.is_all" >
						<image src="@/static/image/system/dui.png" mode=""></image>
					</view>
					<view class="noselecticon" v-show="!list.is_all"></view>
				</view>
				<view><text class="allchange">全选</text></view>
			</view>
			<view class="flexright">
				<text class="pagebottom_fahuo margin_right" v-show="return_status==20" @click="quhuoFn(66)">一键取货</text>
				<text class="pagebottom_huizong" @click="msghuizong(2,70)">数据汇总</text>
			</view>
		</view>
		<!-- 筛选数据 -->
		<u-popup round="20" :show="show" @close="show=false">
			<view class="mainpadding">
				<view class="flexcenter">
					<view class="titletext">筛选</view>
				</view>
				<view class="strongtext margin_top">时间</view>
				<view class="flexleft" style="flex-wrap: wrap;">
					<view class="screenbox flexcenter" v-for="(item,index) in datelist" :key="item.id"
						@click="change(item.name,index)">
						<view :class="currents == index? 'itemscreenfocus margin_top':'itemscreen margin_top'">
							{{item.name}}
						</view>
					</view>
				</view>
				<view class="strongtext margin_top">自定义时间</view>
				<view class="flexleft">
					<view class="inputscreenbox flexcenter" @click="shows=true">
						<input class="itemscreen margin_top" type="text" disabled v-model="start">
					</view>
					<view class="zwscreenbox flexcenter">
						<view class="strongtext">-</view>
					</view>
					<view class="inputscreenbox flexcenter" @click="showss=true">
						<input class="itemscreen margin_top" type="text" disabled v-model="end">
					</view>
				</view>
				<view class="itemscreens flexleft margin_top"
					@click="selectRole('/pages/workbench/jiben/yuangongda?type=2')">
					<view class="strongtext minwidth">经办人</view>
					<view class="rightscreen flexbetween">
						<input type="text" class="strongtext" disabled="true" placeholder="请选择员工" v-model="staff_name">
						<view class="righticon2"></view>
					</view>
				</view>
				<view class="itemscreens flexleft margin_top"
					@click="selectRole('/pages/workbench/jiben/kehuda?type=1')">
					<view class="strongtext minwidth">客户</view>
					<view class="rightscreen flexbetween">
						<input type="text" class="strongtext" disabled="true" placeholder="请选择客户" v-model="custom_name">
						<view class="righticon2"></view>
					</view>
				</view>
				<view class="itemscreens flexleft margin_top" @click="khDengJiShow=true">
					<view class="strongtext minwidth">客户等级</view>
					<view class="rightscreen flexbetween">
						<input type="text" class="strongtext" disabled="true" placeholder="请选择客户等级"
							v-model="khDengJiText">
						<view class="righticon2"></view>
					</view>
				</view>
				<view class="flexbetween">
					<view class="surebtn reset flexcenter" style="margin-top: 60rpx;" @click="resetbtn">重置</view>
					<view class="surebtn flexcenter" style="margin-top: 60rpx;" @click="init">确认</view>
				</view>
			</view>
		</u-popup>
		<u-datetime-picker :show="shows" v-model="value1" title="开始时间" mode="date" @confirm="confirm"
			@cancel="shows=false" @close="shows=false"></u-datetime-picker>
		<u-datetime-picker :show="showss" v-model="value2" title="结束时间" mode="date" @confirm="confirms"
			@cancel="showss=false" :minDate="mintime"
			@close="showss=false"></u-datetime-picker>
		<u-modal :show="modal_show" title="请输入拒收原因!" showCancelButton @confirm="juconfirm"
			@cancel="modal_show = false">
			<view class="slot-content">
				<view class="mainpadding2">
					<textarea class="textarea mainpadding radius margin_top" placeholder="请输入拒收原因"
						v-model="js_notes"></textarea>
				</view>
			</view>
		</u-modal>
		<selectKHDengJi :message="{khDengJiShow:khDengJiShow}" @khDengJiSure="khDengJiSure"></selectKHDengJi>
		<!-- 客户等级 -->
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				currenttab: 1, //1销售，2退货
				yqs_all: false, //已签收
				show: false,
				// 日期筛选
				currents: -1,
				start: '开始时间',
				end: '结束时间',
				shows: false,
				showss: false,
				value1: Number(new Date()),
				value2: Number(new Date()),
				mintime: Number(new Date()),
				maxtime: Number(new Date()),
				datelist: [{
						id: 1,
						name: '今日'
					},
					{
						id: 2,
						name: '昨日'
					},
					{
						id: 3,
						name: '本月'
					},
				],
				distance_sort: 0, //是否由近到远排序，0不排序，1排序
				lat: "",
				lng: "",
				modal_show: false,
				jsid: "",
				keywords: "",
				js_notes: "", //拒收原因
				seal_status: 30, //销售单状态
				return_status: 20, //退货单状态
				// 客户
				custom_id: "",
				custom_name: "",
				// 业务员
				staff_id: "",
				staff_name: "",
				// 客户等级
				khDengJiShow: false,
				khDengJiText: "",
				custom_level_id: "",
				page: 1,
				limit: 12,
				list: {
					data: [],
				},
				allNum:{},
				pageShow:false,
				onloads:false,
				
				
			}
		},
		onLoad() {
			// #ifdef APP-PLUS
			this.getlocation()
			// #endif
			// #ifdef MP-WEIXIN || H5
			this.init()
			// #endif
		},
		watch:{
			list:{
				deep:true,
				handler(newval){
					let num = 0
					let num1 = 0
					this.list.data.forEach(item=>{
						if(!item.is_disabled){
							num1++
						}
						if(item.is_check){
							num++
						}
					})
					if(num1==num && num1!=0){
						this.list.is_all = true
					}else{
						this.list.is_all = false
					}
				}
			}
		},
		onShow() {
			this.getNum()
			uni.$off('khSelectFn');
			uni.$on('khSelectFn', (data) => {
				console.log(data, "9999999");
				this.custom_id = data.id
				this.custom_name = data.name
				// this.custom_data = data.data
				return false

			})
			uni.$off('ygSelectFn');
			uni.$on('ygSelectFn', (data) => {
				this.staff_id = data.id
				this.staff_name = data.name
				return false
			})
			if(this.onloads){
				this.init()
			}
		},
		methods: {
			init(isPage, page) {
				let _this = this;
				this.show = false
				// uni.showLoading({
				// 	mask:true,
				// 	title:"加载中。。。"
				// })
				console.log(12,'99999');
				let url = "/dhtapi/Saleorder/driverOrderIndex"
				if (this.currenttab == 2) {
					url = "/dhtapi/Salethorder/driverThOrderIndex"
				}
				httpRequest.request(url, 'GET', {
					page: page || 1,
					limit: 12,
					start_time: this.start == "开始时间" ? "" : this.start, //开始时间
					end_time: this.end == "结束时间" ? "" : this.end, //结束时间
					status: this.currenttab == 1 ? this.seal_status : this.return_status,
					custom_id: this.custom_id, //客户id
					staff_id: this.staff_id, //业务员id
					custom_level_id: this.custom_level_id, //等级id
					distance_sort: this.distance_sort,
					lat: this.lat,
					lng: this.lng
				}, false, false, true).then(res => {
					if (res.code == 1) {
						this.$set(res.data,'is_all',false)
						res.data.data.forEach(item => {
							this.$set(item, "is_check", false)
							this.$set(item, "is_disabled", false)
							// 销售单=》待收货=》送达需付款
							if(this.currenttab == 1 && this.seal_status==40 && Number(item.arrears_price)){
								item.is_disabled = true
							}
						})
						let resList = res.data.data;
						if (isPage == true) {
							_this.list.data = _this.list.data.concat(resList);
						} else {
							_this.list = res.data
							_this.list.data = resList;
						}
						this.pageShow = true
					}
					console.log(res,'99999');
					// uni.hideLoading()
				}).catch(err => {
					// uni.hideLoading()
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.datarr[this.current].list;
				let page = _this.datarr[this.current].page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.datarr[this.current].page = page;
				_this.init(true, page, this.current);
			},
			selectRole(url) {
				uni.navigateTo({
					url
				})
			},
			khDengJiSure(e) { //客户等级
				if (e) {
					this.khDengJiText = e.value[0].name
					this.custom_level_id = e.value[0].id
				}
				this.khDengJiShow = false
			},
			selectab(val, i) {
				this[val] = i
				this.init()
			},
			// 重置
			resetbtn() {
				this.currents = -1
				this.start = "开始时间"
				this.end = "结束时间"
				this.custom_id = ""
				this.custom_name = ""
				// 业务员
				this.staff_id = ""
				this.staff_name = ""
				this.khDengJiText = ""
				this.custom_level_id = ""
				this.init()
			},
			// 单选
			changeCheck(item){
				item.is_check = item.is_check?false:true
			},
			// 多选
			changeAllCheck(){
				if(this.list.is_all){
					this.list.is_all = false
					this.list.data.forEach(item=>{
						item.is_check = false
					})
				}else{
					this.list.is_all = true
					this.list.data.forEach(item=>{
						if(!item.is_disabled){
							item.is_check = true
						}
					})
				}
			},
			getIds(){
				let arr = []
				this.list.data.forEach(item=>{
					if(item.is_check && !item.is_disabled){
						arr.push(item.id)
					}
				})
				if (arr.length == 0) {
					httpRequest.toast("请选择至少一条数据！")
					return false
				}
				console.log(arr,"999");
				return arr.join()
			},
			// 一键取货取货
			quhuoFn(qxpdid) {
				if (!httpRequest.qxpd(qxpdid, this.$store.state.userInfo.ability_rule_ids)) {
					return false
				}
				if(!this.getIds()){
					return false
				}
				let ids = this.getIds()
				let url = "/dhtapi/Saleorder/saleGetGoods"
				if(this.currenttab==2){
					url = "/dhtapi/Salethorder/salethGetGoods"
				}
				httpRequest.request(url, 'GET', {
					ids: ids
				}).then(res => {
					httpRequest.toast(res.msg)
					if (res.code == 1) {
						this.init()
					}
				}).catch(err => {
					httpRequest.toast(err.msg)
				})
			},
			quhuoapi(ids,qxpdid) {
				if (!httpRequest.qxpd(qxpdid, this.$store.state.userInfo.ability_rule_ids)) {
					return false
				}
				let url = "/dhtapi/Saleorder/saleGetGoods"
				if(this.currenttab==2){
					url = "/dhtapi/Salethorder/salethGetGoods"
				}
				httpRequest.request(url, 'GET', {
					ids: ids
				}).then(res => {
					httpRequest.toast(res.msg)
					if (res.code == 1) {
						this.init()
						this.getNum()
					}
					
				}).catch(err => {
					httpRequest.toast(err.msg)
				})
			},
			// 确认送达
			songdaFn(qxpdid) {
				if (!httpRequest.qxpd(qxpdid, this.$store.state.userInfo.ability_rule_ids)) {
					return false
				}
				if(!this.getIds()){
					return false
				}
				let ids = this.getIds()
				this.songdaapi(ids,62)
			},
			songdaapi(ids,qxpdid) {
				if (!httpRequest.qxpd(qxpdid, this.$store.state.userInfo.ability_rule_ids)) {
					return false
				}
				httpRequest.request('/dhtapi/Saleorder/saleOrderSd', 'GET', {
					ids: ids
				}).then(res => {
					httpRequest.toast(res.msg)
					if (res.code == 1) {
						this.init()
						this.getNum()
					}
				}).catch(err => {
					httpRequest.toast(err.msg)
				})
			},
			getNum(){
				httpRequest.request('/dhtapi/Saleorder/driverOrderData', 'GET', {
					start_time: this.start == "开始时间" ? "" : this.start, //开始时间
					end_time: this.end == "结束时间" ? "" : this.end, //结束时间
					custom_id: this.custom_id, //客户id
					staff_id: this.staff_id, //业务员id
					custom_level_id: this.custom_level_id, //等级id
				}).then(res => {
					this.allNum = res.data
				}).catch(err => {
					httpRequest.toast(err.msg)
				})
			},
			// 拒收
			jushoubtn(id,qxpdid) {
				if (!httpRequest.qxpd(qxpdid, this.$store.state.userInfo.ability_rule_ids)) {
					return false
				}
				this.modal_show = true
				this.jsid = id
			},
			// 销售单拒收确定
			juconfirm() {
				if (this.js_notes == "") {
					httpRequest.toast("请输入拒收原因！")
					return false
				}
				this.modal_show = false
				let url = "/dhtapi/Saleorder/saleOrderJs"
				if(this.currenttab==2){
					url = "/dhtapi/Salethorder/salethOrderJs"
				}
				httpRequest.request(url, 'GET', {
					js_notes: this.js_notes,
					id: this.jsid,
				}).then(res => {
					if (res.code == 1) {
						httpRequest.toast("拒收成功")
						this.init()
						this.getNum()
					} else {
						httpRequest.toast(res.msg)
					}
				}).catch(err => {
					httpRequest.toast(err.msg)
				})
			},
			// 获取当前位置信息
			getlocation() {
				let _this = this
				// console.log("获取经纬度信息")
				this.onloads = true
				uni.getLocation({
					type: 'gcj02',
					geocode: true, //设置该参数为true可直接获取经纬度及城市信息
					success: function(res) {
						console.log(res,"获取经纬度信息")
						_this.lat = res.latitude
						_this.lng = res.longitude
						_this.init()
					},
					fail(err) {
						console.log(err, "定位错误信息")
					}
				});
			},
			// 数据汇总
			msghuizong(type,qxpdid) {
				if (!httpRequest.qxpd(qxpdid, this.$store.state.userInfo.ability_rule_ids)) {
					return false
				}
				if(!this.getIds()){
					return false
				}
				let ids = this.getIds()
				
				uni.navigateTo({
					url: "/pages/workbench/caigou/dinghuodetail?ids=" + ids + "&type="+type
				})
			},
			confirm(e) {
				console.log(e);
				this.shows = false;
				this.show = true;
				this.end = '结束时间';
				this.mintime = e.value;
				this.start = this.date(e.value);
				this.currents = -1;
			},
			confirms(e) {
				this.showss = false;
				this.show = true;
				this.maxtime = e.value;
				this.end = this.date(e.value);
				this.currents = -1;
			},
			date(timer) {
				var date = new Date(timer); //当前时间
				var year = date.getFullYear() //返回指定日期的年份
				var month = repair(date.getMonth() + 1); //月
				var day = repair(date.getDate()); //日
				var curTime = year + "-" + month + "-" + day

				function repair(i) {
					if (i >= 0 && i <= 9) {
						return "0" + i;
					} else {
						return i;
					}
				}
				return curTime
			},
			change(name, index) {
				if (name == "今日") {
					this.start = this.riqi(0);
					this.end = this.riqi(0);
				} else if (name == "昨日") {
					this.start = this.riqi(-1);
					this.end = this.riqi(-1);
				} else if (name == "本月") {
					this.start = this.benyue();
					this.end = this.riqi(0);
				}
				this.currents = index;
			},
			// 昨天“-1”今天“0”明天“1”
			riqi(day) {
				let dd = new Date();
				dd.setDate(dd.getDate() + day);
				let y = dd.getFullYear();
				let m = dd.getMonth() + 1 < 10 ? "0" + (dd.getMonth() + 1) : dd.getMonth() + 1;
				let d = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();
				return y + "-" + m + "-" + d;
			},
			// 本月第一天
			benyue() {
				let y = new Date().getFullYear(); //获取年份
				let m = new Date().getMonth() + 1; //获取月份
				let d = '01'
				m = m < 10 ? '0' + m : m; //月份补 0
				return [y, m, d].join("-")
			},

			// 打开地图
			openmap(item) {
				uni.openLocation({
					latitude: Number(item.latitude), //即将传到高德或腾讯地图的终点纬度  必须是数值，字符串无效
					longitude: Number(item.longitude), //即将传到高德或腾讯地图的终点经度  必须是数值，字符串无效
					name: item.address, //即将传到高德或腾讯地图的店铺名称
					address: item.address, //即将传到高德或腾讯地图的详细地址
				})
			},
			// 确认送达收款
			sdShoukuan(id,qxpdid) {
				if (!httpRequest.qxpd(qxpdid, this.$store.state.userInfo.ability_rule_ids)) {
					return false
				}
				uni.navigateTo({
					url: "/pages/workbench/xiaoshou/qianshousk?id="+id
				})
			},
			selecChangetab(i) {
				this.currenttab = i
				this.init()
			},
			gotoBack() {
				uni.navigateBack(1)
			},
			jumpdetail(id){
				if(this.currenttab==1){
					uni.navigateTo({
						url:'/pages/workbench/xiaoshou/xiaoshoudxq?id='+id+"&type=2"
					})
				}else{
					uni.navigateTo({
						url: '/pages/workbench/xiaoshou/tuihuodxq?id=' + id+"&type=2"
					})
				}
			},
			// phone(p) {
			// 	uni.makePhoneCall({
			// 		phoneNumber: p.toString()
			// 	}).catch((e) => {
			// 		// console.log(e)  //用catch(e)来捕获错误{makePhoneCall:fail cancel}
			// 	})
			// },
			// 米，公里转换
			kmUnit(m) {
				var v;
				if (typeof m === 'number' && !isNaN(m)) {
					if (m >= 1000) {
						v = (m / 1000).toFixed(2) + 'km'
					} else {
						v = m + 'm'
					}
				} else {
					v = '0m'
				}
				return v;
			}
		}
	}
</script>

<style lang="scss" scoped>
	.ylable {
		position: absolute;
		right: -30rpx;
		top: -30rpx;
		padding: 10rpx 30rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #C8101C;
		background-color: #FAE1E1;
		line-height: 23rpx;
		border-bottom-left-radius: 20rpx;
		border-top-right-radius: 20rpx;
	}

	.importtwo {
		color: #FFAE68;
		background-color: #F9EBDD;
	}

	.importthree {
		color: #FFAE68;
		background-color: #F9EBDD;
	}

	.importfour {
		color: #478FDB;
		background-color: #E2EDFB;
	}

	.importfive {
		color: #59C38F;
		background-color: #E3F2E8;
	}

	.selecttimetext {
		font-size: 24rpx;
		font-family: San Francisco Display-Medium, San Francisco Display;
		font-weight: 500;
		color: #666666;
		line-height: 24rpx;
	}

	.seletext {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
		line-height: 28rpx;
	}

	.noselectbox {
		padding: 6rpx 30rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #999999;
		line-height: 33rpx;
		background-color: #eff0f0;
		border-radius: 30rpx;
		margin-right: 30rpx;
	}

	/* // tab切换 */
	.selectbox {
		padding: 6rpx 30rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #0BBDCB;
		line-height: 33rpx;
		background-color: #e1f4f5;
		border-radius: 30rpx;
		margin-right: 30rpx;
	}

	.biankuang {
		padding-bottom: 30rpx;
		border-bottom: 2rpx solid rgba(153, 153, 153, 0.05);
	}

	.juli {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #0BBDCB;
	}

	.dizhi {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #737373;
	}

	.bigtext {
		font-size: 32rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #000000;
	}

	.textimgs {
		width: 20rpx;
		height: 20rpx;
		background-image: url('@/static/image/system/littleblue.png');
		background-size: 100% 100%;
		margin-top: 16rpx;
		margin-left: 16rpx;
	}

	.bigtextco {
		color: #0BBDCB;
		margin-left: 30rpx;
	}

	// tab切换
	.tabs {
		padding: 30rpx 84rpx;
	}

	.focustext {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #0BBDCB;
	}

	.nofocustext {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #000;
	}

	.fenge {
		width: 1rpx;
		height: 28rpx;
		background-color: #f5f5f5;
	}
	.textarea {
		box-sizing: border-box;
		background-color: #F8F8F8;
		height: 180rpx;
	}

	.check {
		padding: 16rpx;
		border-radius: 20rpx;
		background-color: #0BBDCB;
	}

	.childbottom {
		width: 500rpx;
		margin: 30rpx 0 0;
		border-radius: 10rpx;
		padding: 10rpx 20rpx 20rpx;
		text-align: center;
		letter-spacing: 10rpx;
		background-image: linear-gradient(to right, #0BBDCB, #41D4E2);
		background: #00B855;
	}

	.childbottomtxt {
		color: #fff;
		font-size: 28rpx;
	}

	.jushou {
		border-radius: 10rpx;
		padding: 10rpx 20rpx;
		border: 1rpx solid #FF0000;
		background-color: #ffe5e5;
		text-align: center;
		color: #FF0000;
		width: 80rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
	}

	.pagebottom {
		padding: 40rpx 40rpx 40rpx 0;
		background-color: #fff;
		position: fixed;
		bottom: 0;
		width: 100%;
		box-sizing: border-box;
	}

	.allchange {
		margin-left: 18rpx;
		font-size: 32rpx;
		font-weight: bold;
	}

	.pagebottom_left {
		width: 200rpx;
	}

	.pagebottom_right {
		width: 400rpx;
		margin-left: 100rpx;
	}

	.pagebottom_fahuo {
		color: #0BBDCB;
		padding: 10rpx 40rpx;
		font-size: 28rpx;
		border-radius: 30rpx;
		border: 2rpx solid #0BBDCB;
	}

	.pagebottom_huizong {
		color: #fff;
		padding: 10rpx 40rpx;
		font-size: 28rpx;
		border-radius: 30rpx;
		background-color: #00B855;
	}

	.screenbox {
		width: 33.33%;
	}

	.itemscreenfocus {
		width: 200rpx;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		border-radius: 50rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #0BBDCB;
		background-color: #e7f9fa;
	}

	.inputscreenbox {
		width: 40%;

		input {
			width: 100%;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			border-radius: 50rpx;
			font-size: 28rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #333;
			background-color: #f7f9fa;
		}
	}

	.itemscreen {
		width: 200rpx;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		border-radius: 50rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
		background-color: #f7f9fa;
	}

	.zwscreenbox {
		width: 20%;
		line-height: 80rpx;
	}
	.disselecticon {
		width: 30rpx;
		height: 30rpx;
		border-radius: 50%;
		border: 1rpx solid #999999;
		background-color: #999999;
		image {
			width: 20rpx;
			height: 12rpx;
			margin-bottom: 20rpx;
			margin-left: 5rpx;
		}
	}

	// 选择框
	.itemscreens {
		padding-bottom: 20rpx;
	}

	.rightscreen {
		width: 100%;
	}

	.right {
		width: 100%;
	}

	.minwidth {
		min-width: 130rpx;
	}

	.surebtn {
		width: 45%;
	}

	.reset {
		background: #ebb563;
	}

	.searchbox {
		padding: 12rpx 20rpx;
		box-sizing: border-box;
		background-color: #f3f3f3;
		border-radius: 50rpx;

		input {
			width: 80%;
			font-size: 22rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			height: 24rpx;
			min-height: 30rpx;
		}
	}

	.changeimage {
		background-image: url("../../../static/image/system/change.png");
		background-size: 100% 100%;
		width: 24rpx;
		height: 22rpx;
	}

	.lansetext {
		font-size: 24rpx;
		text-decoration: underline #0BBDCB;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #0BBDCB;
		margin-right: 10rpx;
	}

	.allbtn {
		width: 218rpx;
		height: 52rpx;
		border-radius: 50rpx;
		font-size: 24rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
	}

	.lansebtn {
		color: #0BBDCB;
		background: rgba(11, 189, 203, .1);
	}

	.huisebtn {
		color: #999999;
		background: rgba(153, 153, 153, .1);
	}

	.xiankuan {
		width: 300rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.xia {
		height: 12rpx;
		width: 20rpx;
		background-image: url("../../../static/image/system/xiajiantou.png");
		background-size: 100% 100%;
	}

	.shang {
		height: 12rpx;
		width: 20rpx;
		background-image: url("../../../static/image/system/shang.png");
		background-size: 100% 100%;
	}

	// 顶部自定义
	.header-top-box {
		height: 170rpx;
		width: 100%;
	}

	.konghezi {
		// width: 30rpx;
		height: 30rpx;
	}

	.header-top {
		width: 100%;
		box-sizing: border-box;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 1000;
		background-color: #fff;
		padding: 96rpx 40rpx 10rpx;
	}

	.top-image {
		margin-top: 20rpx;
		width: 20rpx;
		height: 38rpx;
		background: url('@/static/image/system/return.png') no-repeat;
		background-size: 20rpx 38rpx;
	}

	// 顶部tab
	.tab1 {
		border: 2rpx solid #0BBDCB;
		border-top-left-radius: 5rpx;
		border-bottom-left-radius: 5rpx;
		padding: 10rpx 30rpx;
	}

	.tab2 {
		border: 2rpx solid #0BBDCB;
		border-left: none;
		border-top-right-radius: 5rpx;
		border-bottom-right-radius: 5rpx;
		padding: 10rpx 30rpx;
	}

	// 选中的顶部
	.selecbottab {
		background-color: #0BBDCB;
		color: #FFFFFF;
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;

	}

	// 未选中的顶部
	.noselecbottab {
		background-color: #fff;
		color: #0BBDCB;
		font-size: 24rpx;

		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
	}
</style>